#include <stdio.h>
#include <stdlib.h>

typedef int TElemSet;

typedef struct BinaryTreeNode *BinaryTree;
struct BinaryTreeNode {
    TElemSet data; /* 数据元素 */
    BinaryTree left; /* 左孩子指针 */
    BinaryTree right; /* 右孩子指针 */
};

BinaryTree CreateBinaryTree(TElemSet value, BinaryTree left_tree,
                            BinaryTree right_tree) {
    BinaryTree tree;

    tree = (BinaryTree)malloc(sizeof(struct BinaryTreeNode));
    tree->data = value;
    tree->left = left_tree;
    tree->right = right_tree;
    return tree;
}

void Visit(BinaryTree tree) {
    printf("%d\n", tree->data);
}

/* 算法5-2：前序遍历二叉树 PreOrder(tree) */
void PreOrder(BinaryTree tree) {
    if (tree != NULL) {
        Visit(tree);
        PreOrder(tree->left);
        PreOrder(tree->right);
    }
}
/* 算法5-2 结束 */

int main(void) {
    BinaryTree tree, left_tree, right_tree;
    TElemSet value;

    scanf("%d", &value);
    left_tree = CreateBinaryTree(value, NULL, NULL);
    scanf("%d", &value);
    right_tree = CreateBinaryTree(value, NULL, NULL);
    scanf("%d", &value);
    tree = CreateBinaryTree(value, left_tree, right_tree);
    PreOrder(tree);

    return 0;
}